Interop Forms Toolkit
How To Deploy A Hybrid Application

Visual Basic 6.0 applications that contain InteropForms or Interop UserControls can be deployed using a Visual Studio .NET Setup and Deployment project, automatically registering the interop assemblies and installing any prerequisites. Alternatively, you can modify an existing Setup script to deploy and register the assemblies, or you can bootstrap an existing setup.exe by creating a custom bootstrapper package.

To deploy with a Setup and Deployment project in Visual Studio .NET

  1. On the File menu, click New Project.
  2. In the New Project dialog box, click Other Project Types, Setup and Deployment, Setup Project.
  3. Enter a name for the Setup project and click OK.
  4. In the File System Editor, select the Application Folder.
  5. On the Action menu, click Add, File.
  6. In the Add File dialog box, browse to the location of your Visual Basic 6.0 .exe and select it, and then click Open. Note that only the .exe is added - if your application has dependencies, you must repeat the process for each dependency.
  7. On the Action menu, click Add, File.
  8. In the Add File dialog box, browse to the location of your Interop UserControl or InteropForm and select it, and then click Open. Note that when it is added, any dependencies are also added.
  9. For each .dll in Solution Explorer, select the file and in the Properties window, select the Register property and set it to vsdraCOM.
  10. Right-click the files Microsoft.InteropFormTools.dll and Microsoft.InteropFormTools.tlb and click Exclude. (These will be installed using the redistributable package in step 13).
  11. On the Project menu, click Properties.
  12. In the Property Pages, click Prerequisites.
  13. In the Prerequisites dialog box, check the Microsoft InteropForms Toolkit 2.0 checkbox, and then click OK.
  14. In the Property Pages, click OK.
  15. On the Build menu, choose Build to build a Setup.exe and a .msi file for your application.

 

To integrate with an existing setup script

If you want to modify an existing setup script to deploy your Hybrid Application, you will need to add a step to properly install the new .NET assemblies. The sections below show how to deploy .NET assemblies (both InteropForms assemblies and Interop UserControl assemblies) for use in a Hybrid Application.

 

Option 1: Registering as Private Assemblies

  1. Deploy your .NET assemblies to the application folder.
  2. Deploy regasm.exe for use by your installer.
  3. Run regasm.exe to register the Interop assembly (for example: regasm c:\appPath\myForms.dll or regasm c:\appPath\myControls.dll).
  4. Deploy any additional assemblies that are required dependencies of the InteropForm assemblies.
  5. Have your setup script launch the redistributable package named Microsoft Interop Forms Toolkit 2.0 MSI. This file can be found in C:\program files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\Microsoft InteropForms Toolkit.

 

Option 2: Registering as Shared Assemblies

  1. Deploy the assemblies to a shared folder.
  2. Deploy gacutil.exe for use by your installer.
  3. Run gacutil.exe to install your Interop assembly in the Global Assembly Cache (for example: gacutil /if c:\sharedPath\myForms.dll or gacutil /if c:\sharedPath\myControls.dll).
  4. Deploy regasm.exe for use by your installer.
  5. Run regasm.exe to register the Interop assembly (for example: regasm c:\appPath\myForms.dll or regasm c:\appPath\myControls.dll).
  6. Deploy any additional assemblies that are required dependencies of the InteropForm assemblies.
  7. Have your setup script launch the redistributable package named Microsoft Interop Forms Toolkit 2.0 MSI. This file can be found in C:\program files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\Microsoft InteropForms Toolkit.

 

Creating a custom bootstrapper to install Prerequisites

Applications using Interop Forms or InteropUserControls require both the .Net Framework 2.0 and the InteropForms runtime to be installed on the client machines.   If you use a Visual Studio .NET Setup and Deployment project to build your setup, you can use the prerequisites dialog to build a setup.exe that will install these components.  If you are using a different setup method (for example, the Visual Basic 6.0 Package and Deployment wizard), you can use msbuild to build a bootstrapper setup program that will install these prerequisites for you.  

 

To create a custom bootstrapper

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

     <!-- Include the 'Product code' for every package you want -->

         <ItemGroup>

             <BootstrapperFile Include="Microsoft.Net.Framework.2.0">

                 <ProductName>.NET Framework 2.0</ProductName>

             </BootstrapperFile>

             <BootstrapperFile Include="Microsoft.InteropForms.Toolkit">

                   <ProductName>Microsoft Interop Forms Toolkit 2.0</ProductName>

             </BootstrapperFile>

        </ItemGroup>

 

        <!-- Specify the setup you wish to bootstrap here -->

        <Target Name="Bootstrapper">

            <GenerateBootstrapper

                ApplicationFile="MyLegacySetup.exe"

                ApplicationName="My Setup"

                BootstrapperItems="@(BootstrapperFile)"

                Culture="en" FallbackCulture="en-US"

                CopyComponents="True" Validate="True"

                OutputPath="d:\outputpath\" />

        </Target>

</Project>

   Note:  You may need to copy your legacy setup.exe and any related files to the outputpath as well.

There are a lot of customizations that can be done with the bootstrapper technology.   For more information, see:

http://msdn2.microsoft.com/en-us/library/ms164294.aspx

http://blogs.msdn.com/chrsmith/archive/2005/06/29/MSBuilding-a-Bootstrapper-via-the-command-line.aspx